%
% Settings file
%
\include{settings}	% Document settings file

%
% We use the book class
%
\documentclass[12pt]{book}

%
% The geometry package allows consistent control of page layout
%
\usepackage[paper = a4paper,         %To be shrunk to 80% when printed
			twoside,                 %Two-side mode, switches margins on 
			bindingoffset = 2mm,     %Offset for binding side of page
			hmargin = 25mm,          %Left and right margin
			vmargin = 25mm,          %Top and bottom margin
			dvipdfm]
			{geometry}

%
% Font settings
%
\usepackage[T1]{fontenc}	% Activate Type 1 fonts
\usepackage{mathptmx}       % Use Times font, also for math
\usepackage[scaled]{helvet} % for sans serif fonts (\textsf{...} or \sffamiliy)
%\usepackage[scaled]{luximono} % for monospaced fonts (\texttt{...} or \ttfamily)



%
% Packages we need
%
\usepackage{graphicx}       % Handles figures
\usepackage[utf8]{inputenc} % We want æøå
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage[mathcal]{euscript} % For caligraphy fonts
\usepackage{booktabs}       % Publication quality tables
\usepackage{setspace}       % Easy setting of line spacing
\usepackage{forloop}		% For-loops!
\usepackage[numbers,
			sort&compress
			]{natbib}       % Sort numerical keys for multiple cites
\usepackage{hypernat}       % Avoid breaking 'backref' option of hyperref package
\usepackage{float}
\usepackage[dvipsnames]{color}   % named colors
\usepackage[procnames]{listings} % beautiful listings
\usepackage{units}				 % semantically represent numbers with units
     

%
% The hyperref package allows advanced hyperlinking functionality
%
\usepackage[dvipdfmx,        % Use dvipdf driver
			backref,         % List citing occurences in the References
			colorlinks,      % Colored links
			citecolor=blue,  % Color of cite links
			linkcolor=blue,  % Color of links
			urlcolor=blue,   % Color of urls
			]{hyperref}
%\newcommand{\aref}[1]{\autoref*{#1}} % Prevent links
\newcommand{\aref}[1]{\autoref{#1}} % Enable links


%
% Set fancy page header using fancyhdr package
% 
\usepackage{fancyhdr}
\pagestyle{fancy}

% Ensure that the chapter and section headings are in lowercase
\setlength{\headheight}{15pt}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}

% Delete current section for header/footer
\fancyhf{}

% Define header/footer layout
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}

% make space for the rule
\fancypagestyle{plain}{
	\fancyhead{} %get rid of the headers on plain pages
	\renewcommand{\headrulewidth}{0pt} % and the line
}

%
% Set header height to 30pt to make room for two rows in the header
% (useful if you have very long chapter names)
%
%\headheight 30pt


%
% Include user-defined macros
%
\include{macros}

%
% TeX is very proud of its hyphenation engine, to the point where it 
% hyphenates _everything_ just to show off.  Increasing penalty for 
% hyphenation, and increase tolerance for underfull boxes can make 
% the text easier to read, at the expense of making the text less aligned
% to the right margin
%
\hyphenpenalty=10
\tolerance=1000


% Redefine include command -> input command
%\renewcommand{\include}{\input}

% Include only these chapters
%\includeonly{introduction}


%
% Set up the frontpage, with author, title, etc
%
\title{
	\bf{Title goes here}
	\author{
		Author\vspace{6em}\\
		Dissertation for the degree of master \vspace{3.5em}\\
		\includegraphics{figurer/uglo}\vspace{1em}\\
		Department of Physics and Technology \\
		University of Bergen
	}
	\date{Month year}
}


%====================================================
%------------------ BEGIN DOCUMENT ------------------
%====================================================
\begin{document}
%Cause all references in bibtex file to appear in the 'References' section, even
%if they are not explicitly cite'ed in the document
%\nocite{*}

%Set the fontsize and baselineskip, if something other than 10 or 12 is required
\ifDownscaledFinalDoc
	\fontsize{\TextSize}{\BaseLineSkip}
	\selectfont
\fi

%Double line spacing for draft
\ifDraft
	\doublespacing
\fi


%--------------------------------------------------------------------------------------------------
% FRONT MATTER
%--------------------------------------------------------------------------------------------------
\maketitle
\frontmatter
\include{acknowledgements}
\tableofcontents
\listoffigures
\lstlistoflistings

%--------------------------------------------------------------------------------------------------
% MAIN MATTER
%--------------------------------------------------------------------------------------------------
\mainmatter

%
% Main chapters
%
\include{introduction}         % Introduction

%
% Appendices
%
\appendix
\include{appendixA}             % Appendix A: Something


%--------------------------------------------------------------------------------------------------
% BACK MATTER
%--------------------------------------------------------------------------------------------------
\backmatter

%
% The bibliography
%

%
% Physics-style bibliography
%
%\bibliographystyle{iopart-num}

%
% Modified mathematics bibliography. Uses acm.bst
%
\bibliographystyle{acm}

\bibliography{master}

\end{document}

